package com.zhiyou100.loans.dao.impl;

import java.sql.ResultSet;
import java.util.Date;

import com.zhiyou100.loans.dao.RefundbillDao;
import com.zhiyou100.loans.util.JDBCUtil;

public class RefundbillDaoImpl implements RefundbillDao {
	JDBCUtil util = new JDBCUtil(); 
	@Override
	public int add(int id, double monthmoney, Date monthend, int i) {
		String sql = "insert into refundbill(loanbillid,money,endtime,months) values(?,?,?,?)";
		Object[] objs= {id,monthmoney,monthend,i};
		return util.update(sql, objs);
	}
	@Override
	public ResultSet selectByLbid(int parseInt,Date date2) {
		String sql = "select id,money,months from refundbill where loanbillid=? and realtime is null and endtime<?  order by months asc ";
		Object[] objs = {parseInt,date2};
		return util.query(sql, objs);
	}
	@Override
	public int update(int parseInt, Date currentTime) {
		String sql = "update refundbill set realtime=? where id=?";
		Object[] objs={currentTime,parseInt};
		return util.update(sql, objs);
	}

}
